<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>题目列表</title>
</head>
<body>
<h1>题目清单</h1>
<a th:if="${isAdmin eq 'YES'}" href="/problem/addproblem">添加题目</a>
<table border="1">
    <tr>
        <td>记录</td>
        <td>题目</td>
        <td>难度</td>
        <td th:if="${isAdmin eq 'YES'}">操作</td>
    </tr>
    <tr th:each="problem:${problems}">
        <td th:if="${problem.history.status eq 0}">尚未尝试</td>
        <td th:if="${problem.history.status eq 1}">已通过</td>
        <td th:if="${problem.history.status eq 2}">未通过</td>
        <td > <a target="_blank" th:text="${problem.problem.title}" th:href="${'/problem/'+problem.problem.problemid}"></a></td>
        <td th:text="${problem.problem.difficulty}"></td>
        <td th:if="${isAdmin eq 'YES'}"><a th:href="${'/problem/modify/'+problem.problem.problemid}">修改</a>
            <a th:href="${'/api/problem/delete/'+problem.problem.problemid}">删除</a></td>
    </tr>
</table>
<table>
    <tr>
        <td ><a th:if="${nowPage gt 0}" th:href="@{'/problem/list?page='+ ${nowPage-1} }">上一页</a></td>
        <td th:text="@{'第'+${nowPage+1}+'页'}"></td>
        <td ><a th:if="${nowPage lt totalPage-1}" th:href="@{'/problem/list?page='+ ${nowPage+1} }">下一页</a></td>
    </tr>
</table>
<a th:if="${isAdmin eq 'YES'}" href="/adminhomepage">主页</a>
<a th:if="${isAdmin eq 'NO'}" href="/userhomepage">主页</a>
</body>
</html>